Add option to 'discard' filter to require minimum number of satellites.
authorrobertl <robertl>
Wed, 6 Feb 2008 02:29:21 +0000 (02:29 +0000)
committerrobertl <robertl>
Wed, 6 Feb 2008 02:29:21 +0000 (02:29 +0000)
discard.c
xmldoc/filters/discard.xml

index d8f1942c58d7c885c57c1970f6097ba7e7d83fd2..0a8d29e4d3fda902ea0d4411637ee89033e47e64 100644 (file)
--- a/discard.c
+++ b/discard.c
 static char *hdopopt = NULL;
 static char *vdopopt = NULL;
 static char *andopt = NULL;
+static char *satopt = NULL;
 static double hdopf;
 static double vdopf;
+static int satpf;
 static gpsdata_type what;
 static route_head *head;
 
@@ -39,6 +41,8 @@ arglist_t fix_args[] = {
                "-1.0", ARGTYPE_END_REQ | ARGTYPE_FLOAT, ARG_NOMINMAX},
        {"hdopandvdop", &andopt, "Link hdop and vdop supression with AND",
                NULL, ARGTYPE_BOOL, ARG_NOMINMAX},
+       {"sat", &satopt, "Minimium sats to keep waypoints",
+               "-1.0", ARGTYPE_BEGIN_REQ | ARGTYPE_INT, ARG_NOMINMAX},
        ARG_TERMINATOR
 };
 
@@ -51,6 +55,7 @@ fix_process_wpt(const waypoint *wpt)
        int del = 0;
        int delh = 0;
        int delv = 0;
+       
        waypoint *waypointp = (waypoint *) wpt;
 
        if ((hdopf >= 0.0) && (waypointp->hdop > hdopf))
@@ -62,6 +67,9 @@ fix_process_wpt(const waypoint *wpt)
                del = delh && delv;
        else
                del = delh || delv;
+               
+        if ((satpf >= 0) && (waypointp->sat < satpf))
+               del = 1;
 
        if (del) {
                switch(what) {
@@ -116,6 +124,12 @@ fix_init(const char *args)
                vdopf = atof(vdopopt);
        else
                vdopf = -1.0;
+       
+       if (satopt)
+               satpf = atoi(satopt);
+       else
+               satpf = -1;
+               
 }
 
 filter_vecs_t discard_vecs = {
index 82bd9bf902ecf3abb3dcd954e91d82757ebda6e4..9b2a2ad267909b37a7a0be4ec6344bdcb1fa023b 100644 (file)
@@ -1,12 +1,26 @@
 <para>
 This filter is used to "fix" unreliable GPS data by discarding points
-with HDOP and/or VDOP above a specified limit.  HDOP and VDOP are 
-measures of the best possible horizontal or vertical precision 
-for a given configuration of GPS satellites.
+that are believed to be unreliable.  You may specify an 
+HDOP and/or VDOP above a specified limit, a minimum number of satellits
+that must have been in view for a fix to be considered, or both.
 </para>
+<para>
+HDOP and VDOP are measures of the best possible horizontal or vertical precision for a given configuration of GPS satellites.   Higher numbers indicate a higher dilution of precision and therefore mathematically less useful.
+</para>
+<para>
 <example id="example_discard_filter">
-<title>Using the discard filter</title>
+<title>Using the discard filter for HDOP and VDOP. </title>
 <para><userinput> gpsbabel -i gpx -f in.gpx -x discard,hdop=10,vdop=20,hdopandvdop -o gpx -F out.gpx</userinput></para>
 </example>
-<para> Contributed by Tobias Minich.</para>
+</para>
+<para>
+You may specify a minimmum number of  satellites.  
+</para>
+<para>
+<example id="example_discard_filter_sats">
+<title>Using the discard filter to require at least three satellites. </title>
+<para><userinput> gpsbabel -i gpx -f in.gpx -x discard,sat=3 -o gpx -F out.gpx</userinput></para>
+</example>
+</para>
+<para> Contributed by Tobias Minich and Serge Droz. </para>